package com.xuxu.blog.controller;

import com.xuxu.blog.entity.ClockEntity;
import com.xuxu.blog.service.ClockService;
import com.xuxu.common.utils.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @className: ClockController
 * @author: Maxuxu
 * @date: 2022/8/29 17:20
 * @description: 打卡的控制类
 */
@RestController
@RequestMapping("/blog")
@Api(value = "clockcontroller",tags = "定位打卡")
@Slf4j
public class ClockController{
    @Autowired
    private ClockService clockService;

    @PostMapping("/clock")
    public R clock(@RequestBody ClockEntity clock) {
        log.debug("传入的内容是:{}",clock);
        boolean save = clockService.save(clock);
        if (save) {
            return R.ok().put("code", 20000);
        }
        return R.error("打卡失败");
    }

}
